<?php
/*
 * 新闻控制器
 * @author     Leo
 * @Created  2016/6/17
 */
namespace Admin\Controller;
// use Think\Controller;
class NewsController extends CommonController {
	//后台新闻首页,可用于查出所有新闻文章
	public function index(){
        $news=D('news');
        $new=$news->select();
        $this->assign('news',$new);
     	$this->display();
 	}
 	//新闻增加
    public function add(){
    	if(!IS_POST){
    		$this->display();
    	}else{
    		$news=D('news');
    		if(!$news->create($_POST)){
    			echo '瞎几把写';
    		}else{
    			if($news->add()){
                    $this->redirect('Admin/News/index');
                }
    		}
    	}

    }

    public function edit(){
		echo I('new_id');
    	$this->display();
    }
}
